GetNumberOfEventLogRecords Method

Gets the number of records in the specified event log.

Syntax

  obj.GetNumberOfEventLogRecords(EventLogName string, NumRecords variant, [MachineName string])
  where obj is an OpScrUtil.EventLog object 

Parameters

EventLogName Specifies the name of the log file from which to retrieve number of records.
NumRecords Number of records in the specified event log.
MachineName Specifies the target computer. This parameter is optional. If not specified or an empty string, the local computer is the target.

Return Type

Boolean

Example

To get the number of records from a System log file, enter:

  Set obj = CreateObject("OpScrUtil.EventLog")
  bOK = obj.GetNumberOfEventLogRecords("System", n)
If bOK <> 0 Then
  MsgBox "The number of records in the eventlog is " & n
Else
  MsgBox obj.GetError()
end if   

This example shows how to get number of records in an event log.